//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "Scene2D/Types/Transform2D.h"

namespace Engine
{
namespace Scene2D
{

	
	//
	// Scene Object Message
	//

	struct SceneObjMsgBase
	{	
		typedef MessageTempl< SceneObjMsgBase >		SceneObjMsg;
	
		//
		// Message Type
		//

		enum EType
		{
			UPDATE = 0,

			ATTACH_TO_SCENE,
			DETACH_FROM_SCENE,
		};

		
		//
		// Base Message Type
		//
		template <EType MinValue, EType MaxValue>
		struct BaseMsg
		{
			static bool IsMessageTypeSupported (EType type)
			{
				return type >= MinValue and type <= MaxValue;
			}
		};


		//
		// Update
		//
		struct Update : BaseMsg< UPDATE, UPDATE >
		{
			// in
			float	timeDelta;
			///
			explicit
			Update (float dt) : timeDelta(dt)
			{}
		};


		//
		// Attach to Scene
		//
		struct AttachToScene : BaseMsg< ATTACH_TO_SCENE, DETACH_FROM_SCENE >
		{
			// in
			SceneManager *	sm;
			SceneObject *	obj;
			///
			explicit
			AttachToScene (SceneManager *sm, SceneObject *obj) : sm(sm), obj(obj) {}
		};


		typedef TypeList10< Update, AttachToScene >::type		type_list_t;
	};
	
	typedef MessageTempl< SceneObjMsgBase >		SceneObjMsg;


}	// Scene2D
}	// Engine